<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <title>客户端顾问管理</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.2.3/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        .sidebar {
            position: fixed;
            top: 0;
            bottom: 0;
            left: 0;
            z-index: 100;
            padding: 48px 0 0;
            box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
            background-color: #f8f9fa;
            width: 240px;
            transition: all 0.3s;
        }
        .sidebar-sticky {
            position: relative;
            top: 0;
            height: calc(100vh - 48px);
            padding-top: .5rem;
            overflow-x: hidden;
            overflow-y: auto;
        }
        .navbar-brand {
            padding-top: .75rem;
            padding-bottom: .75rem;
            font-size: 1rem;
            background-color: rgba(0, 0, 0, .25);
            box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
        }
        .main-content {
            margin-left: 240px;
            padding: 20px;
            transition: all 0.3s;
        }
        @media (max-width: 991.98px) {
            .sidebar {
                width: 100%;
                height: auto;
                position: relative;
                padding-top: 0;
            }
            .sidebar-sticky {
                height: auto;
            }
            .main-content {
                margin-left: 0;
            }
        }
        @media (max-width: 767.98px) {
            .sidebar {
                top: 5rem;
            }
            .table-responsive {
                font-size: 0.875rem;
            }
            .btn-sm {
                padding: 0.25rem 0.5rem;
                font-size: 0.75rem;
            }
        }
        /* 表格响应式优化 */
        @media (max-width: 576px) {
            .table-sm td, .table-sm th {
                padding: 0.3rem;
            }
            .d-flex.flex-wrap {
                flex-direction: column;
            }
            .btn-toolbar {
                margin-top: 1rem;
            }
        }
        /* 模态框响应式优化 */
        @media (max-width: 576px) {
            .modal-dialog {
                margin: 0.5rem;
            }
        }
        /* 导航项样式优化 */
        .nav-link {
            padding: 0.5rem 1rem;
            border-radius: 0.25rem;
            margin-bottom: 0.25rem;
        }
        .nav-link:hover {
            background-color: rgba(0, 0, 0, 0.05);
        }
        .nav-link.active {
            background-color: #0d6efd;
            color: white !important;
        }
        /* 表格操作按钮间距 */
        .btn-action {
            margin-right: 0.25rem;
            margin-bottom: 0.25rem;
        }
    </style>
</head>
<body>
    <header class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
        <a class="navbar-brand col-md-3 col-lg-2 me-0 px-3" href="../index.html">AI智能体管理系统</a>
        <button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
    </header>

    <div class="container-fluid">
        <div class="row">
            <nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
                <div class="position-sticky pt-3">
                    <ul class="nav flex-column">
                        <li class="nav-item">
                            <a class="nav-link" href="ai-agent.html">
                                <i class="fas fa-robot"></i> AI智能体管理
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="ai-agent-client.html">
                                <i class="fas fa-link"></i> 智能体客户端关联
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="ai-agent-task.html">
                                <i class="fas fa-tasks"></i> AI代理任务调度
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link active" href="ai-client-advisor.html">
                                <i class="fas fa-user-tie"></i> 客户端顾问管理
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="ai-client-advisor-config.html">
                                <i class="fas fa-cog"></i> 客户端顾问配置
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="ai-client-model.html">
                                <i class="fas fa-microchip"></i> 客户端模型管理
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="ai-client-model-config.html">
                                <i class="fas fa-cogs"></i> 客户端模型配置
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="ai-client-system-prompt.html">
                                <i class="fas fa-comment-dots"></i> 系统提示词管理
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="ai-client-tool-config.html">
                                <i class="fas fa-tools"></i> 客户端工具配置
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="ai-client-tool-mcp.html">
                                <i class="fas fa-tools"></i> MCP工具管理
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="ai-rag-order.html">
                                <i class="fas fa-file-invoice-dollar"></i> RAG订单管理
                            </a>
                        </li>
                    </ul>
                </div>
            </nav>

            <main class="col-md-9 ms-sm-auto col-lg-10 px-md-4 main-content">
                <div id="content-client-advisor">
                    <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
                        <h1 class="h2">客户端顾问管理</h1>
                        <div class="btn-toolbar mb-2 mb-md-0">
                            <button type="button" class="btn btn-sm btn-outline-primary" id="btn-add-client-advisor">
                                <i class="fas fa-plus"></i> <span class="d-none d-sm-inline">新增顾问</span>
                            </button>
                        </div>
                    </div>

                    <div class="row mb-3">
                        <div class="col-12 col-md-6">
                            <div class="input-group">
                                <input type="text" class="form-control" id="search-advisor-name" placeholder="顾问名称">
                                <button class="btn btn-outline-secondary" type="button" id="btn-search-advisor">搜索</button>
                            </div>
                        </div>
                    </div>

                    <div class="table-responsive">
                        <table class="table table-striped table-sm">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>顾问名称</th>
                                    <th>顾问类型</th>
                                    <th>排序号</th>
                                    <th class="d-none d-md-table-cell">扩展参数</th>
                                    <th>状态</th>
                                    <th class="d-none d-md-table-cell">创建时间</th>
                                    <th class="d-none d-lg-table-cell">更新时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody id="client-advisor-list">
                                <!-- 数据将通过JavaScript动态加载 -->
                            </tbody>
                        </table>
                    </div>

                    <nav aria-label="Page navigation" class="mt-3">
                        <ul class="pagination pagination-sm flex-wrap justify-content-center" id="pagination">
                            <!-- 分页将通过JavaScript动态加载 -->
                        </ul>
                    </nav>
                </div>
            </main>
        </div>
    </div>

    <!-- 新增/编辑客户端顾问模态框 -->
    <div class="modal fade" id="clientAdvisorModal" tabindex="-1" aria-labelledby="clientAdvisorModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="clientAdvisorModalLabel">新增客户端顾问</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <form id="clientAdvisorForm">
                        <input type="hidden" id="client-advisor-id">
                        <div class="mb-3">
                            <label for="client-advisor-name" class="form-label">顾问名称</label>
                            <input type="text" class="form-control" id="client-advisor-name" required>
                        </div>
                        <div class="mb-3">
                            <label for="client-advisor-type" class="form-label">顾问类型</label>
                            <input type="text" class="form-control" id="client-advisor-type" required>
                        </div>
                        <div class="mb-3">
                            <label for="client-advisor-order" class="form-label">排序号</label>
                            <input type="number" class="form-control" id="client-advisor-order" value="0">
                        </div>
                        <div class="mb-3">
                            <label for="client-advisor-ext-param" class="form-label">扩展参数</label>
                            <textarea class="form-control" id="client-advisor-ext-param" rows="3"></textarea>
                        </div>
                        <div class="mb-3">
                            <label for="client-advisor-status" class="form-label">状态</label>
                            <select class="form-select" id="client-advisor-status">
                                <option value="1">启用</option>
                                <option value="0">禁用</option>
                            </select>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="btn-save-client-advisor">保存</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 确认删除模态框 -->
    <div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="deleteModalLabel">确认删除</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <p>确定要删除这个客户端顾问吗？此操作不可恢复。</p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-danger" id="btn-confirm-delete">删除</button>
                </div>
            </div>
        </div>
    </div>

    <script src="../../js/config.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.2.3/js/bootstrap.bundle.min.js"></script>
    <script src="../js/client-advisor.js"></script>
    <script src="../js/main.js"></script>
</body>
</html>